# 1)使用while和for…in两个循环分别输出四种九九乘法表效果（共计8个）

# for循环输出
print("for循环输出")
# 三角靠左
for i in range(10):
    for j in range(i):
        print("{}*{}={:<2}  ".format(j+1,i,(i)*(j+1)),end="")
    print()
print('='*70)
for i in range(9,0,-1):
    for j in range(1,i+1):
        print("{}*{}={:<2}  ".format(j,i,i*j),end ="")
    print()

# 三角靠右
for i in range(1,10):
    print(" "*(72-8*i),end="")
    for j in range(i,0,-1):
        print("{}*{}={:<2}  ".format(j,i,i*j),end="")
    print()

print('='*70)
for i in range(9,0,-1):
    print(" "*(72-8*i),end="")    
    for j in range(i,0,-1):
        print("{}*{}={:<2}  ".format(j,i,i*j),end ="")
    print()


# while循环输出
print("while循环输出")
# 三角靠左
i =1
while i < 10:
    j = 0
    while j < i:
        j+=1
        print("{}*{}={:<2}  ".format(j,i,i*j),end="")
    i+=1
    print()
print("="*70)
i = 9
while i>0:
    j = 1
    while j <= i:
        print("{}*{}={:<2}  ".format(j,i,i*j),end="")
        j+=1
    i-=1
    print()

# 三角靠右
i =1
while i < 10:
    j = i
    print(" "*(72-8*i),end="")
    while j > 0:        
        print("{}*{}={:<2}  ".format(j,i,i*j),end="")
        j-=1
    i+=1
    print()

print("="*70)
i = 9
while i>0:
    j = i
    print(" "*(72-8*i),end="")
    while j > 0:
        print("{}*{}={:<2}  ".format(j,i,i*j),end="")
        j-=1
    i-=1
    print()
